/*
 * udp_socket.h
 *
 *  Created on: 2008-11-27
 *      Author: fanliangliang
 */

#ifndef UDP_SOCKET_H_
#define UDP_SOCKET_H_

#include "socket.h"

BEGIN_NAMESPACE_TOXIC

class UdpSocket : public Socket {
public:
	UdpSocket();
	virtual ~UdpSocket();

	void bind(const IpAddress& address, uint16_t port);
	void bind(const SocketAddress& address);
	void bind(uint16_t port);

	size_t sendTo(const void* buffer, size_t length, const IpAddress& address, uint16_t port);
	size_t sendTo(const void* buffer, size_t length, const SocketAddress& address);
	size_t receiveFrom(void* buffer, size_t length, IpAddress* address, uint16_t* port);
	size_t receiveFrom(void* buffer, size_t length, SocketAddress* address);
};

END_NAMESPACE_TOXIC

#endif /* UDP_SOCKET_H_ */
